
#include <stdint.h>
#include <string.h>
#include <strings.h>
#include <netinet/in.h>

// Macros for recasting chars to longs and shorts
#define LONG  * (uint32_t*) &
#define SHORT * (uint16_t*) &


typedef struct {

  uint8_t data[14];

  uint8_t dest[6];
  uint8_t src[6];
  uint8_t ip_flag;
  uint8_t arp_flag;


} ethernetHeader;


void parseEthernet ( ethernetHeader * h ) {

  memcpy( h->src, &h->data[0], 6 );
  memcpy( h->dest, &h->data[6], 6 );
  h->arp_flag = 0;
  h->ip_flag = 0;
  uint8_t arp[2] = {0x08, 0x06};
  uint8_t ip[2] = {0x08, 0x00};

  if ( ! bcmp( &h->data[12], arp, 2 ) ) {
    h->arp_flag = 1;
    h->ip_flag = 0;
  }
  if ( ! bcmp( &h->data[12], ip, 2 ) ) {
    h->arp_flag = 0;
    h->ip_flag = 1;
  }

  
  
  

}

			   
